﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WX.WMS.DataModel;

namespace WX.WMS.BLL
{
    public class StockTakeReportBLL : BaseBLL
    {
        public class VStockTakeItem : T_STOCKTAKE_DETAIL
        {
            private string _ProductName;
            private string _Model;
            private string _Standard;
            private string _Size;
            private string _Origin;
            private string _Brand;
            private DateTime? _Instock_Date;
            private string _StockName;
            private string _AreaName;
            private string _FloorName;
            private string _BarCode;
            private string _Unit;
            private string _WeightUnit;
            private string _BigClass;
            private string _SupplyLotNumber;
            private string _KeyStandard;

            public string KeyStandard
            {
                get { return _KeyStandard; }
                set { _KeyStandard = value; }
            }

            public string SupplyLotNumber
            {
                get { return _SupplyLotNumber; }
                set { _SupplyLotNumber = value; }
            }
            public string BigClass
            {
                get { return _BigClass; }
                set { _BigClass = value; }
            }
            public string ProductName
            {
                get { return _ProductName; }
                set { _ProductName = value; }
            }
            public string Model
            {
                get { return this._Model; }
                set { this._Model = value; }
            }
            public string Standard
            {
                get { return this._Standard; }
                set
                {
                    this._Standard = value;
                }
            }
            public string Size
            {
                get { return this._Size; }
                set { this._Size = value; }
            }
            public string Origin
            {
                get { return this._Origin; }
                set { this._Origin = value; }
            }
            public string Brand
            {
                get { return this._Brand; }
                set
                {
                    this._Brand = value;
                }
            }
            public DateTime? Instock_Date
            {
                get { return this._Instock_Date; }
                set { this._Instock_Date = value; }
            }
            public string StockName
            {
                get { return _StockName; }
                set { _StockName = value; }
            }
            public string AreaName
            {
                get { return this._AreaName; }
                set { this._AreaName = value; }
            }
            public string FloorName
            {
                get { return this._FloorName; }
                set { this._FloorName = value; }
            }
            public string BarCode
            {
                get { return _BarCode; }
                set { this._BarCode = value; }
            }
            public string Unit
            {
                get { return _Unit; }
                set { this._Unit = value; }
            }
            public string WeightUnit
            {
                get { return _WeightUnit; }
                set { this._WeightUnit = value; }
            }
        }

        public IEnumerable<VStockTakeItem> GetVStockTakeItem(string StockTakeID)
        {
            var source = from t in new BaseDAO().T_STOCKTAKE_DETAILs
                         where t.STOCKTAKE_ID.Value.ToString() == StockTakeID
                         select new VStockTakeItem
                         {
                             AreaName = t.T_STORE.T_FLOOR.T_STOCK_AREA.AREA_NAME,
                             BarCode = t.T_STORE.T_PRODUCT_DETAIL.BAR_CODE,
                             Brand = t.T_STORE.T_PRODUCT_DETAIL.BRAND,
                             FloorName = t.T_STORE.T_FLOOR.FloorName,
                             Instock_Date = t.T_STORE.T_PRODUCT_DETAIL.InStock_Date,
                             Model = t.T_STORE.T_PRODUCT_DETAIL.MODEL,
                             Origin = t.T_STORE.T_PRODUCT_DETAIL.ORIGIN,
                             ProductName = t.T_STORE.T_PRODUCT_DETAIL.T_PRODUCT.NAME,
                             Size = t.T_STORE.T_PRODUCT_DETAIL.SIZE,
                             Standard = t.T_STORE.T_PRODUCT_DETAIL.STANDARD,
                             StockName = t.T_STORE.T_FLOOR.T_STOCK_AREA.T_STOCK.STOCK_NAME,
                             Unit = t.T_STORE.T_PRODUCT_DETAIL.T_PRODUCT.T_UNIT.NAME,
                             WeightUnit = t.T_STORE.T_PRODUCT_DETAIL.T_PRODUCT.T_UNIT1.NAME,
                             GROSS_WEIGHT = t.GROSS_WEIGHT,
                             ID = t.ID,
                             NET_WEIGHT = t.NET_WEIGHT,
                             OVERAGE = t.OVERAGE,
                             PACKET_QTY = t.PACKET_QTY,
                             PACKET_QTY2 = t.PACKET_QTY2,
                             STOCKTAKE_ID = t.STOCKTAKE_ID,
                             STOREID = t.STOREID,
                             BigClass=t.T_STORE.T_PRODUCT_DETAIL.BigClass,
                             SupplyLotNumber=t.T_STORE.T_PRODUCT_DETAIL.SUB_LOT_NUMBER,
                             KeyStandard=t.T_STORE.T_PRODUCT_DETAIL.KeyStandard
                            
                         };
            return source;
        }
    }
}
